class IntegralRank {
  String realName;
  String deptName;
  String headUrl;
  int userRank;
  double grade;
  double avgGrade;
  List<IntegralRankItem> behindRankList;
  List<IntegralRankItem> frontRankList;

  IntegralRank({
    this.realName,
    this.deptName,
    this.headUrl,
    this.userRank,
    this.grade,
    this.avgGrade,
    this.behindRankList,
    this.frontRankList,
  });

  factory IntegralRank.fromJson(Map<String, dynamic> json) {
    return IntegralRank(
      realName: json['realname'],
      deptName: json['deptName'],
      headUrl: json['headUrl'],
      userRank: json['userRank'] ?? 0,
      grade: json['totalGrade'] ?? 0.0,
      avgGrade: json['avgGrade'] ?? 0.0,
      behindRankList: json['behindRankList'] == null ? [] : (json['behindRankList'] as List).map((e) => IntegralRankItem.fromJson(e)).toList(),
      frontRankList: json['frontRankList'] == null ? [] : (json['frontRankList'] as List).map((e) => IntegralRankItem.fromJson(e)).toList(),
    );
  }
}

class IntegralRankItem {
  String deptName;
  String realName;
  String headUrl;
  int rank;
  double avgGrade;
  double grade;

  IntegralRankItem({
    this.realName,
    this.deptName,
    this.headUrl,
    this.rank,
    this.avgGrade,
    this.grade,
  });

  factory IntegralRankItem.fromJson(Map<String, dynamic> json) {
    return IntegralRankItem(
      realName: json['realname'],
      deptName: json['deptName'],
      headUrl: json['headUrl'],
      rank: json['rank'] ?? 0,
      avgGrade: json['avgGrade'] ?? 0.0,
      grade: json['totalGrade'] ?? 0.0,
    );
  }
}
